-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gen docs in js actions #14
base: master
Are you sure you want to change the base?
Conversation
@@ -268,6 +268,7 @@ function renderTypeDoc(name: string, def: any): string[] { | |||
if (propLines.length) lines.push(`${DOC}`) | |||
join(lines, propLines) | |||
lines.push(' */') | |||
lines.push(`const ${name}=null`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify this one? It's not need to add code in my testing. Also setting to null causes issues for people not allowing null's in their code base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not really needed. For what i see the Types.js file is not really used anywhere.
It does not contain any code
It's there just to give code completion.
My problem was that some CodeEditor's would not find the @typedef
and won't give code completion as they assume that typedef is not defined.
But this probably a problem to be solved in code editors, not in code gen, thought it does not hurt anyone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it is removed by code minification, but potentially it can hurt "anyone" because you're potentially shipping more bytes through the wire.
@@ -48,14 +48,17 @@ function renderReduxActionBlock(spec: ApiSpec, op: ApiOperation, options: Client | |||
if (required.length) params += ', options' | |||
else params = 'options' | |||
} | |||
|
|||
const docsArray=renderOperationDocs(op) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets you most of the way there, but the promise returned from redux action creators are not the same as the promise returned from the raw service call. This means there's incorrect promise typings being gen'd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh yes you are right, didn't tough about that as mostly i only wanted to get completion in action's arguments.
So probably this needs more work, can't just use the same gen docs from the other methods.
@@ -1,6 +1,6 @@ | |||
import { writeFileSync, join, groupOperationsByGroupName, camelToUppercase, getBestResponse } from '../util' | |||
import { DOC, SP, ST, getDocType, getTSParamType } from './support' | |||
import { renderParamSignature, renderOperationGroup } from './genOperations' | |||
import {renderParamSignature, renderOperationGroup, renderOperationDocs} from './genOperations' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, right. The block was formatted by the code editor on import.
Should have payed more attention before commit and submit the PR
@porfirioribeiro thanks for the pull request. Left a few comments. |
@mikestead I will look at all your comments and try to fix all. |
Generate the same docs for redux actions as we have in plain openapi call's
Usefull for code completition of actions